Skip to content

fix: repair cross-package bugs to make all tests pass - #92

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2490-1785040085
Open

fix: repair cross-package bugs to make all tests pass#92
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier3-2490-1785040085

Conversation

@stooit

@stooit stooit commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the four cross-package bugs in the monorepo so all tests pass and tsc --noEmit is clean. No test files modified, no dependencies added.

Fixes

  • utils → apps/web: apps/web/src/lib/api.ts imported the old hook name useThrottle, which was renamed to useDebounce in packages/utils. Updated the import to resolve.
  • ui/Button: The component dropped aria-* / passthrough props. Now extends React.ButtonHTMLAttributes<HTMLButtonElement> and spreads ...rest onto <button>, so the caller's aria-label reaches the element. Icon-only buttons get a fallback accessible name when none is supplied (a test renders an icon-only button with no aria-label and asserts the attribute is non-null).
  • ui/DataTable: Stale-closure bug in the sort handler — it read sortDir from the closure. Switched to a functional setSortDir(prev => ...) updater so a second click correctly sorts descending.
  • utils/date: formatDate now uses day: "numeric" (en-AU) so single-digit days render without a confusing leading zero, matching the test's /^1/ expectation for 1 March 2024.
  • tsconfig.json: Added bun-types (test globals) and included apps/*/test/**/* so app tests are type-checked too. strict: true and skipLibCheck unchanged — this tightens coverage, it does not loosen type safety.

Assumptions / Notes

  • formatDate retains a normalisation step for the day field: Bun's bundled ICU (v73) zero-pads en-AU days regardless of day: "numeric" vs 2-digit (permitted ECMA-402 implementation latitude). The format option is now semantically correct (numeric); the normalisation compensates for the runtime's ICU behaviour so output is stable across environments.
  • The icon-only Button fallback accessible name exists because a test asserts a non-null aria-label when none is passed; callers passing their own aria-label always win.

Verification

  • bun test packages/utils/test packages/ui/test apps/web/test --preload ./packages/ui/test/setup.ts13 pass, 0 fail
  • node_modules/.bin/tsc --noEmitclean (exit 0)

- utils: rename stale useThrottle import to useDebounce in apps/web api
- ui/Button: forward aria-* and passthrough props to <button>; provide
  fallback accessible name for icon-only buttons
- ui/DataTable: use functional setState updater to fix stale-closure sort
- utils/date: use day:"numeric" en-AU format (normalise ICU zero-pad)
- tsconfig: add bun-types and include app tests so all sources type-check

All 13 tests pass; tsc --noEmit clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant